<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<style>
    body{
        text-align: center;
    }
    #addProjectTable{
        margin:30px auto;
        width:100%;
        height:100%;
    }
</style>
<link rel="stylesheet" href="../lib/layui-v2.1.6/layui/css/layui.css">
<body>
    <table class="layui-form" id="addProjectTable">
        <tr>
            <td class="layui-input-inline">
                <label class="layui-form-label">项目名称</label>
                <div class="layui-input-inline">
                    <input name="projectName" lay-verify="required" class="layui-input">
                </div>
            </td>
        </tr>
        <tr>
            <td class="layui-input-inline">
                <label class="layui-form-label">项目类型</label>
                <div class="layui-input-inline">
                    <input name="category" disabled="disabled"  class="layui-input" value="非治疗项目">
                </div>
            </td>
        </tr>
        <tr>
            <td class="layui-input-inline">
                <label class="layui-form-label">费用类型</label>
                <div class="layui-input-inline">
                    <select name="type">
                        <option value="0">收入</option>
                        <option value="1">支出</option>
                    </select>
                </div>
            </td>
        </tr>
        <tr>
            <td class="layui-input-inline">
                <label class="layui-form-label">是否启用</label>
                <div class="layui-input-inline">
                    <select name="status">
                        <option value="0">启用</option>
                        <option value="1">禁用</option>
                    </select>
                </div>
            </td>
        </tr>
        <tr>
            <td>
                <input type="button" lay-submit lay-filter="*" id="submit" style="display:none">
            </td>
        </tr>
    </table>
</body>
<script type="text/javascript" src="../lib/jquery.min.js"></script>
<script type="text/javascript" src="../lib/layui-v2.1.6/layui/layui.js"></script>
<script>
    var isSuccess=0;
    layui.use(['form'],function () {
        var form=layui.form;
        var $=layui.jquery;
        resize();
        form.render();
        form.on('submit(*)',function () {       //新增按钮监听
            var projectName=$('input[name="projectName"]').val();
            var category=$('input[name="category"]').val();
            var type=$('select[name="type"]').find("option:selected").val();
            var status=$('select[name="status"]').find("option:selected").val();
            var addProjectData={
                'projectName':projectName,
                'category':category,
                'type':type,
                'status':status
            }
            <!--
            $.ajax({
                data:addProjectData,
                type:"POST",
                url:'',
                success:function (result) {
                    if(result.code==200){
                        isSuccess=200;
                    }
                }
            })
            -->
        })
    })
    function resize(){
        var bodyHeight=parent.$('#iframeHeight').val()*0.7;
        var bodyWidth=parent.$('#iframeWidth').val()*0.96;
        $('body').css({'height':bodyHeight,'width':bodyWidth});
        var iconSize=$(document.body).width()*0.05;
        $('.icon').css({'font-size':iconSize});
    }
    function addProjectSubmit(){
        $('#submit').click();
        return isSuccess;
    }
</script>
</html>